<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>店铺申请审核</title>
  <link href="../static/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="../static/bootstrap-icons/font/bootstrap-icons.css">
  <style>
    :root {
      --primary-color: #4361ee;
      --secondary-color: #3f37c9;
      --accent-color: #4895ef;
      --light-color: #f8f9fa;
      --dark-color: #212529;
      --success-color: #4cc9f0;
      --warning-color: #f8961e;
      --danger-color: #f72585;
      --border-radius: 8px;
      --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      --border-color: #e0e0e0;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background-color: #f5f7fa;
      color: var(--dark-color);
      line-height: 1.6;
      padding: 20px;
    }

    .container {
      max-width: 1400px;
      margin: 0 auto;
      background: white;
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      overflow: hidden;
    }

    /* 工具栏样式 */
    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 15px;
      padding: 20px;
      background: white;
      border-bottom: 1px solid var(--border-color);
      align-items: center;
    }

    .btn {
      padding: 10px 20px;
      border: none;
      border-radius: var(--border-radius);
      cursor: pointer;
      font-size: 14px;
      transition: all 0.3s;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .btn-primary {
      background-color: var(--primary-color);
      color: white;
    }

    .btn-primary:hover {
      background-color: var(--secondary-color);
    }

    .btn-success {
      background-color: var(--success-color);
      color: white;
    }

    .btn-success:hover {
      background-color: #3ab7d8;
    }

    .btn-danger {
      background-color: var(--danger-color);
      color: white;
    }

    .btn-danger:hover {
      background-color: #e01e69;
    }

    .btn-warning {
      background-color: var(--warning-color);
      color: white;
    }

    .btn-warning:hover {
      background-color: #e0861b;
    }

    .btn-search {
      background-color: var(--success-color);
      color: white;
    }

    .btn-search:hover {
      background-color: #3ab7d8;
    }

    .search-group {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      flex: 1;
      min-width: 200px;
    }

    .form-control {
      padding: 10px 15px;
      border: 1px solid var(--border-color);
      border-radius: var(--border-radius);
      font-size: 14px;
      transition: all 0.3s;
      min-width: 150px;
    }

    .form-control:focus {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
      outline: none;
    }

    /* 统计卡片样式 */
    .stats-container {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 20px;
      padding: 20px;
    }

    .stat-card {
      background: white;
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      padding: 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
    }

    .stat-icon {
      font-size: 40px;
      margin-bottom: 15px;
    }

    .stat-value {
      font-size: 32px;
      font-weight: bold;
      margin-bottom: 5px;
    }

    .stat-label {
      color: #6c757d;
      font-size: 14px;
    }

    .stat-card.pending {
      border-top: 4px solid var(--warning-color);
    }

    .stat-card.approved {
      border-top: 4px solid var(--success-color);
    }

    .stat-card.rejected {
      border-top: 4px solid var(--danger-color);
    }

    .stat-card.total {
      border-top: 4px solid var(--primary-color);
    }

    /* 表格样式 */
    .table-container {
      width: 100%;
      overflow-x: auto;
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
    }

    .data-table thead {
      background-color: var(--primary-color);
      color: white;
    }

    .data-table th {
      padding: 15px;
      text-align: center;
      font-weight: 500;
      font-size: 14px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .data-table tbody tr {
      border-bottom: 1px solid var(--border-color);
      transition: all 0.2s ease;
    }

    .data-table tbody tr:hover {
      background-color: rgba(67, 97, 238, 0.05);
    }

    .data-table td {
      padding: 15px;
      color: #495057;
      font-size: 14px;
      text-align: center;
      vertical-align: middle;
    }

    /* 操作按钮样式 */
    .btn-approve, .btn-reject, .btn-view {
      padding: 8px 12px;
      margin: 2px;
      font-size: 12px;
      border-radius: 4px;
      border: none;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: all 0.2s ease;
    }

    .btn-approve {
      background-color: var(--success-color);
      color: white;
    }

    .btn-reject {
      background-color: var(--danger-color);
      color: white;
    }

    .btn-view {
      background-color: var(--accent-color);
      color: white;
    }

    .btn-approve:hover, .btn-reject:hover, .btn-view:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    /* 分页器样式 */
    .pagination-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px;
      background: white;
      border-top: 1px solid var(--border-color);
    }

    .page-size-selector {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .page-size-selector label {
      font-size: 14px;
    }

    .pagination {
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .page-btn {
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border-color);
      border-radius: 4px;
      background: none;
      cursor: pointer;
      transition: all 0.2s;
    }

    .page-btn:hover {
      border-color: var(--primary-color);
      color: var(--primary-color);
    }

    .page-btn.active {
      background-color: var(--primary-color);
      border-color: var(--primary-color);
      color: white;
    }

    .page-btn.disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .page-numbers {
      display: flex;
      gap: 5px;
    }

    /* 店铺头像样式 */
    .shop-avatar {
      width: 50px;
      height: 50px;
      object-fit: cover;
      border-radius: 8px;
      border: 2px solid #e0e0e0;
    }

    .shop-avatar-placeholder {
      width: 50px;
      height: 50px;
      border-radius: 8px;
      background-color: #e9ecef;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      color: #adb5bd;
    }

    /* 状态标签 */
    .status-badge {
      padding: 6px 12px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 500;
    }

    .status-pending {
      background-color: #fff3cd;
      color: #856404;
    }

    .status-approved {
      background-color: #d4edda;
      color: #155724;
    }

    .status-rejected {
      background-color: #f8d7da;
      color: #721c24;
    }

    /* 提示框样式 */
    .alert {
      position: fixed;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      padding: 15px 20px;
      border-radius: 4px;
      display: none;
      align-items: center;
      z-index: 1000;
      max-width: 80%;
      animation: slideIn 0.3s ease-out forwards;
    }

    .alert-success {
      background-color: #d4edda;
      color: #155724;
      border: 1px solid #c3e6cb;
    }

    .alert-danger {
      background-color: #f8d7da;
      color: #721c24;
      border: 1px solid #f5c6cb;
    }

    .alert i {
      margin-right: 10px;
      font-size: 18px;
    }

    .alert-close {
      margin-left: 15px;
      background: none;
      border: none;
      color: inherit;
      font-size: 20px;
      cursor: pointer;
    }

    @keyframes slideIn {
      from {
        opacity: 0;
        transform: translate(-50%, -30px);
      }
      to {
        opacity: 1;
        transform: translate(-50%, 0);
      }
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* 加载动画 */
    #compact-loader {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 240px;
      padding: 12px;
      background: rgba(0,0,0,0.85);
      border-radius: 8px;
      display: none;
      align-items: center;
      z-index: 9999;
      color: white;
      font-family: sans-serif;
    }

    .spinner {
      width: 24px;
      height: 24px;
      border: 3px solid rgba(255,255,255,0.2);
      border-top-color: #3498db;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-right: 12px;
    }

    .form-control {
      width: auto;
    }

    /* 店铺信息样式 */
    .shop-info {
      text-align: left;
      max-width: 200px;
    }

    .shop-name {
      font-weight: bold;
      margin-bottom: 5px;
    }

    .shop-desc {
      font-size: 12px;
      color: #6c757d;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    /* 模态框样式 */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(5px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      padding: 20px;
    }

    .modal-content {
      background: white;
      border-radius: 16px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      width: 90%;
      max-width: 900px;
      max-height: 90vh;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      animation: modalSlideIn 0.3s ease-out;
    }

    @keyframes modalSlideIn {
      from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 24px 30px;
      border-bottom: 1px solid var(--border-color);
      background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    }

    .modal-title {
      font-size: 20px;
      font-weight: 600;
      color: var(--dark-color);
      margin: 0;
    }

    .modal-close {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      color: #6c757d;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      transition: all 0.2s ease;
    }

    .modal-close:hover {
      background: rgba(0, 0, 0, 0.1);
      color: var(--dark-color);
    }

    .modal-body {
      flex: 1;
      overflow-y: auto;
      padding: 0;
    }

    .modal-footer {
      padding: 20px 30px;
      border-top: 1px solid var(--border-color);
      display: flex;
      gap: 12px;
      justify-content: flex-end;
      background: #f8f9fa;
    }

    /* 审核详情容器 */
    .audit-detail-container {
      padding: 30px;
    }

    /* 基本信息区域 */
    .basic-info-section {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 30px;
      margin-bottom: 30px;
      padding-bottom: 30px;
      border-bottom: 1px solid var(--border-color);
    }

    .shop-avatar-large {
      width: 120px;
      height: 120px;
      border-radius: 16px;
      overflow: hidden;
      border: 3px solid white;
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    .shop-avatar-large img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .shop-basic-info {
      display: flex;
      align-items: flex-start;
    }

    .info-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      width: 100%;
    }

    .info-item {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .info-item.full-width {
      grid-column: 1 / -1;
    }

    .info-label {
      font-size: 12px;
      color: #6c757d;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .info-value {
      font-size: 14px;
      color: var(--dark-color);
      font-weight: 500;
      padding: 8px 12px;
      background: #f8f9fa;
      border-radius: 8px;
      border-left: 3px solid var(--primary-color);
      min-height: 36px;
      display: flex;
      align-items: center;
    }

    /* 详情信息区域 */
    .detail-info-section {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .section-card {
      background: white;
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 24px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .section-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--dark-color);
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-title i {
      color: var(--primary-color);
    }

    /* 轮播图样式 */
    .carousel-container {
      position: relative;
      border-radius: 12px;
      overflow: hidden;
      background: #f8f9fa;
      margin-bottom: 16px;
    }

    .carousel-wrapper {
      position: relative;
      height: 300px;
      overflow: hidden;
    }

    .carousel-slides {
      display: flex;
      transition: transform 0.3s ease;
      height: 100%;
    }

    .carousel-slide {
      min-width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .carousel-slide img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      background: white;
    }

    .carousel-btn {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 40px;
      height: 40px;
      background: rgba(255, 255, 255, 0.9);
      border: none;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
      transition: all 0.2s ease;
      z-index: 10;
    }

    .carousel-btn:hover {
      background: white;
      transform: translateY(-50%) scale(1.1);
    }

    .carousel-prev {
      left: 16px;
    }

    .carousel-next {
      right: 16px;
    }

    .carousel-indicators {
      position: absolute;
      bottom: 16px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      gap: 8px;
      z-index: 10;
    }

    .carousel-indicator {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.5);
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .carousel-indicator.active {
      background: white;
      transform: scale(1.2);
    }

    .carousel-counter {
      text-align: center;
      font-size: 14px;
      color: #6c757d;
      font-weight: 500;
    }

    .no-images-message {
      text-align: center;
      padding: 60px 20px;
      color: #6c757d;
    }

    .no-images-message i {
      font-size: 48px;
      margin-bottom: 16px;
      display: block;
    }

    .no-images-message p {
      margin: 0;
      font-size: 14px;
    }

    /* 状态标签 */
    .status-badge {
      padding: 6px 12px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 500;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .status-pending {
      background: #fff3cd;
      color: #856404;
      border: 1px solid #ffeaa7;
    }

    .status-approved {
      background: #d4edda;
      color: #155724;
      border: 1px solid #c3e6cb;
    }

    .status-rejected {
      background: #f8d7da;
      color: #721c24;
      border: 1px solid #f5c6cb;
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
      .modal-content {
        width: 95%;
        margin: 10px;
      }

      .audit-detail-container {
        padding: 20px;
      }

      .basic-info-section {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
      }

      .shop-avatar-large {
        margin: 0 auto;
      }

      .info-grid {
        grid-template-columns: 1fr;
      }

      .modal-footer {
        flex-direction: column;
      }

      .carousel-wrapper {
        height: 200px;
      }
    }
    .custom-modal textarea:focus {
      outline: none;
      border-color: #1890ff;
      box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
    }

    .custom-modal button:hover {
      opacity: 0.8;
    }

    .custom-modal button:active {
      transform: translateY(1px);
    }
  </style>
</head>
<body>
<!-- 提示框 -->
<div class="alert alert-danger" id="error-alert" style="display: none;">
  <i class="bi bi-exclamation-circle"></i>
  <span id="error-message">操作失败</span>
  <button class="alert-close">&times;</button>
</div>

<div class="alert alert-success" id="success-alert" style="display: none;">
  <i class="bi bi-check-circle"></i>
  <span id="success-message">操作成功</span>
  <button class="alert-close">&times;</button>
</div>

<div class="container">
  <div class="toolbar">
    <div class="search-group">
      <input type="text" class="form-control" id="shopName" placeholder="请输入店铺名称">
      <select class="form-control" id="statusFilter">
        <option value=>所有状态</option>
        <option value=1>待审核</option>
        <option value=2>已通过</option>
        <option value=3>已拒绝</option>
      </select>
      <button class="btn btn-search" id="searchBtn">
        <i class="bi bi-search"></i> 搜索
      </button>
    </div>
  </div>

  <div class="table-container">
    <table class="data-table">
      <thead>
      <tr>
        <th>ID</th>
        <th>店铺头像</th>
        <th>店铺信息</th>
        <th>店主</th>
        <th>申请时间</th>
        <th>状态</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody id="tableBody">
      <!-- 数据将通过JS动态加载 -->
      </tbody>
    </table>
  </div>

  <div class="pagination-controls">
    <div class="page-size-selector">
      <label for="pageSize">每页显示:</label>
      <select id="pageSize" class="form-control">
        <option value="5">5条</option>
        <option value="10" selected>10条</option>
        <option value="20">20条</option>
        <option value="50">50条</option>
      </select>
    </div>

    <div class="pagination">
      <button class="page-btn" id="prevPage"><i class="bi bi-chevron-left"></i></button>
      <div class="page-numbers" id="pageNumbers">
        <!-- 页码将通过JS动态生成 -->
      </div>
      <button class="page-btn" id="nextPage"><i class="bi bi-chevron-right"></i></button>
    </div>
  </div>
</div>

<!-- 加载动画 -->
<div id="compact-loader">
  <div class="spinner"></div>
  <span class="text">加载中...</span>
</div>
<!-- 店铺申请审核详情模态框 -->
<div class="modal-overlay" id="shopAuditModal" style="display: none;">
  <div class="modal-content">
    <div class="modal-header">
      <h3 class="modal-title">店铺申请详情</h3>
      <button class="modal-close" onclick="closeShopAuditModal()">&times;</button>
    </div>
    <div class="modal-body">
      <div class="audit-detail-container">
        <!-- 店铺基本信息 -->
        <div class="basic-info-section">
          <div class="shop-avatar-section">
            <div class="shop-avatar-large">
              <img src="" alt="店铺头像" id="auditShopAvatar" onerror="this.src=''"/>
            </div>
          </div>

          <div class="shop-basic-info">
            <div class="info-grid">
              <div class="info-item">
                <div class="info-label">申请ID</div>
                <div class="info-value" id="auditApplicationId">-</div>
              </div>
              <div class="info-item">
                <div class="info-label">店铺名称</div>
                <div class="info-value" id="auditShopName">-</div>
              </div>

              <div class="info-item">
                <div class="info-label">店主姓名</div>
                <div class="info-value" id="auditOwnerName">-</div>
              </div>
              <div class="info-item">
                <div class="info-label">联系电话</div>
                <div class="info-value" id="auditPhone">-</div>
              </div>
              <div class="info-item">
                <div class="info-label">申请时间</div>
                <div class="info-value" id="auditApplyTime">-</div>
              </div>
              <div class="info-item">
                <div class="info-label">当前状态</div>
                <div class="info-value">
                  <span class="status-badge" id="auditStatusBadge">-</span>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 店铺详情信息 -->
        <div class="detail-info-section">
          <div class="section-card">
            <h4 class="section-title">
              <i class="bi bi-info-circle"></i>
              店铺基本信息
            </h4>
            <div class="info-grid">
              <div class="info-item full-width">
                <div class="info-label">店铺简介</div>
                <div class="info-value" id="auditDescription">-</div>
              </div>
              <div class="info-item full-width">
                <div class="info-label">详细地址</div>
                <div class="info-value" id="auditAddress">-</div>
              </div>
              <div class="info-item full-width">
                <div class="info-label">营业时间</div>
                <div class="info-value" id="auditBusinessHours">-</div>
              </div>
            </div>
          </div>

          <!-- 店铺图片轮播 -->
          <div class="section-card">
            <h4 class="section-title">
              <i class="bi bi-images"></i>
              店铺图片
            </h4>
            <div class="carousel-container" id="auditCarouselContainer">
              <div class="carousel-wrapper">
                <div class="carousel-slides" id="auditCarouselSlides">
                  <!-- 图片将通过JS动态生成 -->
                </div>
                <button class="carousel-btn carousel-prev" onclick="prevAuditSlide()">
                  <i class="bi bi-chevron-left"></i>
                </button>
                <button class="carousel-btn carousel-next" onclick="nextAuditSlide()">
                  <i class="bi bi-chevron-right"></i>
                </button>
                <div class="carousel-indicators" id="auditCarouselIndicators">
                  <!-- 指示器将通过JS动态生成 -->
                </div>
              </div>
              <div class="carousel-counter">
                <span id="auditCurrentSlide">1</span> / <span id="auditTotalSlides">0</span>
              </div>
            </div>
            <div class="no-images-message" id="auditNoImagesMessage" style="display: none;">
              <i class="bi bi-image"></i>
              <p>暂无店铺图片</p>
            </div>
          </div>

          <!-- 审核信息 -->
          <div class="section-card" id="auditInfoSection" style="display: none;">
            <h4 class="section-title">
              <i class="bi bi-clipboard-check"></i>
              审核信息
            </h4>
            <div class="info-grid">
              <div class="info-item">
                <div class="info-label">审核人</div>
                <div class="info-value" id="auditReviewer">-</div>
              </div>
              <div class="info-item">
                <div class="info-label">审核时间</div>
                <div class="info-value" id="auditReviewTime">-</div>
              </div>
              <div class="info-item full-width">
                <div class="info-label">审核备注</div>
                <div class="info-value" id="auditReviewNote">-</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="modal-footer" id="auditActionButtons">
      <button class="btn btn-success" onclick="approveShopApplication()">
        <i class="bi bi-check-circle"></i> 通过申请
      </button>
      <button class="btn btn-danger" onclick="rejectShopApplication()">
        <i class="bi bi-x-circle"></i> 拒绝申请
      </button>
      <button class="btn btn-secondary" onclick="closeShopAuditModal()">关闭</button>
    </div>
  </div>
</div>
<script src="../static/js/jquery.js"></script>
<script src="../static/js/jquery.cookie.js"></script>
<script src="../static/js/ShopAduit.js"></script>
</body>
</html>